const { merge } = require('webpack-merge')
const common = require('./webpack.common')
const webpack = require('webpack')
const ESLintPlugin = require('eslint-webpack-plugin');

const config = merge(common, {
    watch: true,
    target: 'web', // webpack5 开启HMR必须
    devServer: {
        contentBase: ['./public'],
        compress: true,
        port: 8080,
        hot: true,
        open: true
    },
    plugins: [
        new webpack.HotModuleReplacementPlugin(),
        new ESLintPlugin({
            files: ['src/*.js', 'src/*.vue', 'src/**/*.js', 'src/**/*.vue']
        })
    ]
});

module.exports = config